package edu.its.dreamteam.daf.dao.ibatis;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import edu.its.dreamteam.daf.beans.DraftPlayer;
import edu.its.dreamteam.daf.dao.IDraftPlayerDao;

public class DraftPlayerDaoImpl extends BaseDaoImpl implements IDraftPlayerDao{

	@Override
	protected String getNamespace() {
		return "DraftPlayer";
	}
	public DraftPlayer getDraftPlayerByRoom(String id_player, String id_room, String status_draft) {
		try {
			Map map = new HashMap();	
			map.put("id_player",id_player);
			map.put("id_room",id_room);
			map.put("status_draft",status_draft);			
			DraftPlayer draftPlayer = (DraftPlayer) getSqlMapClientTemplate().queryForObject(getNamespace()+".getDraftPlayerByRoom", map);
			return draftPlayer;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public List<DraftPlayer> getDraftPlayerByRoomList(String id_room, String status_draft, String sell) {
		try {
			Map map = new HashMap();			
			map.put("id_room",id_room);
			map.put("status_draft",status_draft);			
			map.put("sell",sell);	
			List list = getSqlMapClientTemplate().queryForList(getNamespace()+".getDraftPlayerByRoomList", map);
			return list;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public List<DraftPlayer> getDraftPlayerByPosition(String id_position,
			String status_draft, String id_team, String play) {
		try {
			Map map = new HashMap();			
			map.put("id_position",id_position);
			map.put("status_draft",status_draft);	
			map.put("id_team",id_team);	
			map.put("play",play);	
			
			List list = getSqlMapClientTemplate().queryForList(getNamespace()+".getDraftPlayerByPosition", map);
			return list;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
